export function jsBMap(ak) {
    return new Promise(function (resolve, reject) {
        const script = document.createElement("script");
        script.type = "text/javascript";
        // script.src = "//api.map.baidu.com/api?key=&v=1.1&services=true&callback=init";
        script.src = `http://api.map.baidu.com/api?v=2.0&ak=${ak}&callback=init`
        // script.src = "//api.map.baidu.com/api?type=webgl&v=1.0&ak="+ak+"&services=true&callback=init";
        script.onerror = reject;
        document.head.appendChild(script);
        window.init = function () {
            // resolve(BMapGL)
            resolve(BMap)
        }
    })
}
